import 'package:flutter/material.dart';
import 'package:flutter_business_1803a/bean/category_child_opt_result.dart';
import 'package:flutter_business_1803a/bean/category_goods_opt_list_result.dart';

class ChildCategory with ChangeNotifier {
  List<EntityListBean> childCategoryList = [];
  List<CategoryGoods> categoryGoodsList = [];
  int page = 1; //通过页码来判断是否是切换后的第一页,同时,可以通过page++来加载更多
  int optId = 305;
  String noMoreText = ''; //显示更多的标识
  int childIndex=0;//右侧小导航的标识

  setChildCategory(list) {
    childCategoryList = list;
    notifyListeners();
  }

  setCategoryGoodsList(list) {
    categoryGoodsList = list;
    notifyListeners();
  }

  changeChildIndex(index){
    childIndex=index;
    notifyListeners();
  }

  //增加page的方法
  addPage() {
    page++;
    notifyListeners();
  }

  //设置page归零
  rePage(){
    page=1;
    notifyListeners();
  }

  setOptId(optId) {
    this.optId = optId;
    notifyListeners();
  }

  addGoodsList(list) {
    categoryGoodsList.addAll(list);
    notifyListeners();
  }

  //改变noMoreText数据
  changeNoMore(String text) {
    noMoreText = text;
    notifyListeners();
  }
}
